<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>KEPLER - SISCLAS</title>
	<link type="text/css" rel="stylesheet" href="../resources/css/main.css" />
</h:head>
<h:body>
	<f:view>
		<p:growl id="mensajes" showDetail="true" sticky="true" />
		<h:form prependId="false">
			<center></center>

			<div
				style="margin: 0 auto; position: relative; width: 220px; padding: 0px 30px 30px;">
				<table>
					<tbody>
						<tr>
							<td><img align="left" border="0" class="cuerpo" height="80"
								id="logo"
								src="#{request.contextPath}/resources/img/sisclas_1.jpg" /></td>
						</tr>
						<tr>
							<td><div>
									<p:inputText id="username"
										value="#{usuarioController.usuario_}"
										styleClass="input_username_password" />
									<p:watermark value="Usuario" for="username" />
								</div></td>
						</tr>
						<tr>
							<td>
								<div>
									<p:password id="contrasenia"
										value="#{usuarioController.contrasenia}"
										styleClass="input_username_password">
									</p:password>
									<p:watermark value="Contraseña" for="contrasenia" />
								</div>
							</td>
						</tr>
						<tr>
							<td>
								<div>
									<p:commandButton value="Iniciar Sesión"
										actionListener="#{usuarioController.login}" update=":mensajes"
										oncomplete="manejarLogin(xhr, status, args)"
										styleClass="button_login_blue" />
								</div>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
		</h:form>

	</f:view>
</h:body>
<script type="text/javascript">
	//<![CDATA[
	function manejarLogin(xhr, status, args) {
		if (!args.validationFailed && args.isLogged) {
			setTimeout(function() {
				window.location = args.view;
			}, 1300);
		}
	}
	//]]>
</script>
</html>